package com.heihx.service.Impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.heihx.entity.SetmealDish;
import com.heihx.mapper.SetMealDishMapper;
import com.heihx.service.SetMealDishService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class SetMealDishServiceImpl extends ServiceImpl<SetMealDishMapper, SetmealDish> implements SetMealDishService {
    @Override
    public List<Long> getSetMealIdsByDishIds(List<Long> dishIds) {
        return lambdaQuery()
                .select(SetmealDish::getSetmealId)
                .in(SetmealDish::getDishId, dishIds)
                .list()
                .stream().map(SetmealDish::getSetmealId).collect(Collectors.toList());
    }

}
